using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace eCloudEdit
{
    public partial class CustomVarForm : Form
    {
        public CustomVarForm()
        {
            InitializeComponent();
         
            this.comboBox2.SelectedIndex = 0;
            this.comboBox3.SelectedIndex = 0;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }
        public string svaraddr
        {
            get
            {
                return this.textBox1.Text;
            }
            set
            {
                this.textBox1.Text = value;
            }
        }
        public string svarnum
        {
            get
            {
                return this.textBox2.Text;
            }
            set
            {
                this.textBox2.Text = value;
            }
        }
        public string svafactor
        {
            get
            {
                return this.textBox4.Text;
            }
            set
            {
                this.textBox4.Text = value;
            }
        }
        public string svaroffset
        {
            get
            {
                return this.textBox3.Text;
            }
            set
            {
                this.textBox3.Text = value;
            }
        }
        public string svardesc
        {
            get
            {
                return this.textBox5.Text;
            }
            set
            {
                this.textBox5.Text = value;
            }
        }
        public string varWrite
        {
            get
            {
                return comboBox3.GetItemText(comboBox3.SelectedItem);
            }
            set
            {
                string ss = value;
                if (ss.ToUpper().Equals("TRUE"))
                {
                    comboBox3.SelectedIndex = 1;
                }
                else if (ss.ToUpper().Equals("FALSE"))
                {
                    comboBox3.SelectedIndex = 0;
                }
            }
        }
        public string datatype
        {
            get
            {
                return comboBox2.GetItemText(comboBox2.SelectedItem);
            }
            set
            {
                string ss = value;
                if (ss.Equals("Bit"))
                {
                    comboBox2.SelectedIndex = 0;
                }
                else if (ss.Equals("Int16"))
                {
                    comboBox2.SelectedIndex = 1;
                }
                else if (ss.Equals("Uint16"))
                {
                    comboBox2.SelectedIndex = 2;
                }
                else if (ss.Equals("Int32"))
                {
                    comboBox2.SelectedIndex = 3;
                }
                else if (ss.Equals("Uint32"))
                {
                    comboBox2.SelectedIndex = 4;
                }
                else if (ss.Equals("Float"))
                {
                    comboBox2.SelectedIndex = 5;
                }
                else
                {
                    comboBox2.SelectedIndex = 0;
                }
            }
        }
    }
}